<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <script src="./lib/vue-2.4.0.js"></script>
    </head>
    <body>
        <div id="app">

            <brother></brother>

            <sister></sister>
        </div>
        <script>
            var VueEvent =new Vue();

            var brother = {
                template:'<h2>我是哥哥====妹妹说:{{sis}}</h2>',
                data(){
                    return {
                        brother:'我是哥哥',
                        sis:''
                    }
                },
                methods:{

                },
                mounted(){
                    VueEvent.$on('girs',(data)=>{
                        console.log(data);
                        this.sis=data
                        
                    })
                }
            }
            var sister ={
                template:'<h2 @click="sisters">我是妹妹</h2>',
                data(){
                    return {
                        sistert:'我给你介绍一个女朋友吧'
                    }
                },
                methods:{
                    sisters(){
                        VueEvent.$emit('girs',this.sistert)
                    }

                }
            }
            var vm = new Vue({
                el: '#app',
                data: {

                },
                methods:{


                },
                components:{
                    brother,
                    sister
                }
            })
        </script>
    </body>
</html>